<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<html>

<head>
<title>物流平台</title>
<meta charset="utf-8">
<!-- <link rel="stylesheet" type="text/css" href="css/scroll.css"> -->
<!-- <link rel="stylesheet" type="text/css" href="css/xiami.css"> -->
<link rel="stylesheet" type="text/css"
	href="bootstrap-3.3.5-dist/dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/swiper.min.css" />
<link rel="stylesheet" href="css/index.css">
<style>
body {
	padding-right: 0 !important;
}

.control a:hover {
	cursor: pointer;
	text-decoration: none;
}
</style>
</head>

<body>
	<!--模糊画布-->
	<!-- <div class="playerMain"> -->
	<div class="top">
		<div class="top_body">
			<div class="logo_container">
				<a href='#'><img src="images/logo.PNG" height="59px"></a>
				<div class="input-group">
					<input type="text" class="form-control" placeholder="请输入xxxx">
					<a href="#" class=" input-group-addon"><span
						class="glyphicon glyphicon-search"></span></a>
				</div>
			</div>
			<c:if test="${onlineUser==null }">
				<div>
					<button class="btn btn-info" id="sign_up_btn">登录</button>
					<button class="btn btn-danger" id="register_btn">注册</button>
					<!-- <a href="log-in.html"><span class="glyphicon glyphicon-log-in"></span> 登&nbsp;录</a>
            <a href=""><span class="glyphicon glyphicon-user"></span> 注&nbsp;册</a> -->
				</div>
			</c:if>
		</div>
	</div>
	<!-- <nav class="navbar navbar-default" role="navigation">
    </nav> -->
	<div class="middle">
		<div class="swiper-container">
			<div id="NotArranged" class="swiper-wrapper">
				<div class="swiper-slide">
					<img src="images/lbanner2.jpg" width="100%" height="400">
				</div>
				<div class="swiper-slide">
					<img src="images/lunbo1.jpg" width="100%" height="400">
				</div>
				<div class="swiper-slide">
					<img src="images/lunbo2.jpg" width="100%" height="400">
				</div>
			</div>
			<div class="swiper-button-prev"></div>
			<div class="swiper-button-next"></div>
			<div class="swiper-pagination"></div>
		</div>
	</div>

	<div style="position: relative;">
		<div class="content-wrapper">
			<h2>商品列表</h2>
			<table class="table table-bordered table-hover table-condensed">
				<thead>
					<tr>
						<td>商品ID</td>
						<td>商品名称</td>
						<td>商品数量</td>
						<td>商品价格</td>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${CargoList}" var="d" varStatus="status">
						<tr onclick="showGoods(this)">
							<td class="goodsId">${d.cargoId }</td>
							<td class="goodsName">${d.cargoName }</td>
							<td>${d.cargoCount }</td>
							<td class="goodsPrice">${d.cargoPrice }</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
		<c:if test="${onlineUser!=null }">
			<aside class="main-siderbar">
				<ul style="list-style: none;">
					<a onclick="showOrder()">查看你的订单</a>
					<a onclick="showLinkMan()">查看联系人</a>
					<a onclick="changeUserInfo()">修改个人信息</a>
				</ul>
			</aside>
		</c:if>
	</div>

	<!-- </div> -->
	<div id="sign_up_modal" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">物流用户登陆</h4>
				</div>
				<div class="modal-body">
					<form id="login" action="user/login.aciton" method="post"
						autocomplete="off" class="form-horizontal">
						<div class="form-group">
							<label for="userName" class="col-sm-2 control-label">用戶名</label>
							<div class="col-sm-9">
								<input type="text" id="phone" name="phone" class="form-control"
									value="">
							</div>
						</div>
						<div class="form-group">
							<label for="pwd" class="col-sm-2 control-label">密&nbsp;&nbsp;&nbsp;&nbsp;碼</label>
							<div class="col-sm-9">
								<input type="password" name="password" id="password"
									class="form-control">
							</div>
						</div>
						<input type="submit" id="chk_gg"
							class="btn btn-primary pull-right" value="登入"
							style="margin-right: 9%">
						<div class="clearfix"></div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div id="register_modal" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">物流用户注册</h4>
				</div>
				<div class="modal-body">
					<form id="register" action="user/store.action" method="post"
						autocomplete="off" class="form-horizontal">
						<div class="form-group">
							<label for="userName" class="col-sm-2 control-label">用戶名</label>
							<div class="col-sm-9">
								<input type="text" id="c_name" name="c_name"
									class="form-control" value="">
							</div>
						</div>
						<div class="form-group">
							<label for="userName" class="col-sm-2 control-label">手机号</label>
							<div class="col-sm-9">
								<input type="text" id="c_phone" name="c_phone"
									class="form-control" value="">
							</div>
						</div>
						<div class="form-group">
							<label for="pwd" class="col-sm-2 control-label">密&nbsp;&nbsp;&nbsp;&nbsp;碼</label>
							<div class="col-sm-9">
								<input type="password" name="c_pwd" id="c_pwd"
									class="form-control">
							</div>
						</div>
						<div class="form-group">
							<label for="comfirm_pwd" class="col-sm-2 control-label">确认密碼</label>
							<div class="col-sm-9">
								<input type="password" name="password1" id="password1"
									class="form-control">
							</div>
						</div>
						<input type="submit" id="chk_gg"
							class="btn btn-primary pull-right" value="注册"
							style="margin-right: 9%">
						<div class="clearfix"></div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div id="goods_modal" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">填写派送请求</h4>
				</div>
				<div class="modal-body">
					<form id="dispatch" action="customer/orderStore.action"
						method="post" autocomplete="off" class="form-horizontal">
						<div class="form-group">
							<label for="goodsId" class="col-sm-2 control-label">商品ID</label>
							<div class="col-sm-9">
								<input type="text" id="goodsId" name="goodsId"
									class="form-control" value="" readonly>
							</div>
						</div>
						<div class="form-group">
							<label for="goodsName" class="col-sm-2 control-label">商品</label>
							<div class="col-sm-9">
								<input type="text" id="goodsName" name="goodsName"
									class="form-control" value="" readonly>
							</div>
						</div>
						<div class="form-group">
							<label for="goodsprice" class="col-sm-2 control-label">单价</label>
							<div class="col-sm-9">
								<input type="text" id="goodsPrice" name="goodsPrice"
									class="form-control" value="" readonly>
							</div>
						</div>
						<div class="form-group">
							<label for="goodsNumber" class="col-sm-2 control-label">数量</label>
							<div class="col-sm-9">
								<input type="text" name="goodsNumber" id="goodsNumber"
									class="form-control">
							</div>
						</div>
						<div class="form-group">
							<label for="contactPerson" class="col-sm-2 control-label">选择联系人</label>
							<div class="col-sm-9">
								<select id="contactPerson" name="contactPerson">
									<option value="0">----</option>
									<c:forEach items="${recevierList}" var="d" varStatus="ds">
										<td>${ds.count}</td>
										<option value="${d.rId}">${d.rName}</option>
									</c:forEach>
								</select>
							</div>
						</div>
						<div class="form-group">
							<span class="col-sm-2">&nbsp;</span> <input type="submit"
								id="submitBtn" class="btn btn-success pull-left" value="提交"
								style="margin-right: 5%; margin-left: 3%;"> <input
								type="button" id="releaseBtn" class="btn btn-primary pull-left"
								value="重置">
						</div>
						<div class="clearfix"></div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div id="order_modal" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">查看订单</h4>
				</div>
				<div class="modal-body">
					<table class="table table-bordered table-hover table-condensed">
						<thead>
							<td>订单ID</td>
							<!-- <td>订单物品</td> -->
							<td>数量</td>
							<td>价格</td>
							<td>开始时间</td>
							<td>配送员姓名</td>
							<td>配送员电话</td>
							<td>操作</td>
						</thead>
						<tbody>
							<c:forEach items="${DEList }" var="d" varStatus="ds">
								<tr>
									<td>${d.order.oId}</td>
									<%-- <td>${d.order.orderdetails[0]. }</td> --%>
									<td>${d.order.orderdetails[0].cargoNumber }</td>
									<td>${d.order.oFeetype }</td>
									<td>${d.order.oDate}</td>
									<td>${d.staff.sName }</td>
									<td>${d.staff.sPhone }</td>
									<td><input type="button" name="" value="确认送达"
										class="btn btn-primary"></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
				<!-- <div class="modal-footer">
                    <a href="#">返回</a>
                </div> -->
			</div>
		</div>
	</div>
	<div id="LinkMan_modal" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">
						查看联系人
						<button type="button" onclick="addLinkMan()"
							class="btn btn-success">新增联系人</button>
					</h4>
				</div>
				<div class="modal-body">
					<table class="table table-bordered table-hover table-condensed">
						<thead>
							<td>编号</td>
							<td>联系人姓名</td>
							<td>电话</td>
							<td>省份</td>
							<td>城市</td>
							<td>详细地址</td>
							<td>操作</td>
						</thead>
						<tbody>
							<c:forEach items="${recevierList}" var="d" varStatus="status">
								<tr>

									<td class="recevier_id receiver_${d.rId }">${d.rId }</td>
									<td class="recevier_name receiver_${d.rId }">${d.rName }</td>
									<td class="recevier_phone receiver_${d.rId }">${d.rPhone }</td>
									<td class="recevier_privince receiver_${d.rId }">${d.rPrivince }</td>
									<td class="recevier_city receiver_${d.rId }">${d.rCity }</td>
									<td class="recevier_address receiver_${d.rId }">${d.rAddress }</td>

									<td><input type="button" name="" value="修改"
										class="btn btn-primary" onclick="changeLinkMan(this)"
										data-linkmanid="${d.rId }"> <input type="submit" name=""
										value="删除" class="btn btn-primary"
										onclick="window.location.href='customer/deleteReceiver.action?rId=${d.rId}'"
										data-linkmanid="${d.rId }"></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
				<!-- <div class="modal-footer">
                    <a href="#">返回</a>
                </div> -->
			</div>
		</div>
	</div>
	<div id="changeLinkMan_modal" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">修改联系人</h4>
				</div>
				<div class="modal-body">
					<form id="receiverUpdate" action="customer/rstore.action"
						method="post" autocomplete="off" class="form-horizontal">
						<div class="form-group row">
							<label class="col-sm-3" for="">联系人编号</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_id" value="" readonly>
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">联系人姓名</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_name" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">电话</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_phone" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">省份</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_privince" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">城市</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_city" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">详细地址</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_address" value="">
							</div>
						</div>
						<div class="modal-footer">
							<button type="submit" class="btn btn-success">确认</button>
							<a class="btn btn-default" onclick="hidechangeLinkMan()">取消</a>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div id="addLinkMan_modal" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">新增联系人</h4>
				</div>
				<div class="modal-body">
					<form id="receiverStore" action="customer/addreceiver.action"
						method="post" autocomplete="off" class="form-horizontal">
						<div class="form-group row">
							<label class="col-sm-3" for="">联系人姓名</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_name" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">电话</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_phone" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">省份</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_privince" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">城市</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_city" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">详细地址</label>
							<div class="col-sm-9" id="">
								<input type="text" name="r_address" value="">
							</div>
						</div>
						<div class="modal-footer">
							<button type="submit" class="btn btn-success">确认</button>
							<a class="btn btn-default" onclick="hideaddLinkMan()">取消</a>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div id="user_info_modal" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">修改个人信息</h4>
				</div>
				<div class="modal-body">
					<form id="ustore" action="customer/ustore.action" method="post"
						autocomplete="off" class="form-horizontal">
						<div class="form-group row">
							<label class="col-sm-3" for="">姓名</label>
							<div class="col-sm-9" id="">
								<input type="text" name="c_name" value="${onlineUser.cName }">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">原密码</label>
							<div class="col-sm-9" id="">
								<input type="password" name="c_pwd" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">新密码</label>
							<div class="col-sm-9" id="">
								<input type="password" name="n_pwd" value="">
							</div>
						</div>
						<div class="form-group row">
							<label class="col-sm-3" for="">确认密码</label>
							<div class="col-sm-9" id="">
								<input type="password" name="n_pwd2" value="">
							</div>
						</div>
						<div class="modal-footer">
							<button type="submit" class="btn btn-success">确认</button>
							<a class="btn btn-default" onclick="hideuserInfo()">取消</a>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript" src="jquery-3.1.1/jquery-3.1.1.js"></script>
<script type="text/javascript"
	src="bootstrap-3.3.5-dist/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="js/swiper.jquery.min.js"></script>
<script type="text/javascript">
	$(function() {
		var mySwiper = new Swiper('.swiper-container', {
			autoplay : 5000, //可选选项，自动滑动
			prevButton : '.swiper-button-prev',
			nextButton : '.swiper-button-next',
		})
		$("#sign_up_btn").on('click', function(event) {
			event.preventDefault();
			$("#sign_up_modal").modal();
		});
		$("#register_btn").on('click', function(event) {
			event.preventDefault();
			$("#register_modal").modal();
		});
		$("#releaseBtn").on('click', function(event) {
			event.preventDefault();
			document.getElementById("goodsNumber").value = "";
			$("#contactPerson").val("0");
			/* Act on the event */
		});
	})

	function showGoods(obj) {
		console.log(obj);
		console.log(obj.getElementsByClassName('goodsId')[0].innerHTML);
		$("#goodsId")[0].value = obj.getElementsByClassName('goodsId')[0].innerHTML;
		console.log(obj.getElementsByClassName('goodsName')[0].innerHTML);
		$("#goodsName")[0].value = obj.getElementsByClassName('goodsName')[0].innerHTML;
		console.log(obj.getElementsByClassName('goodsPrice')[0].innerHTML);
		$("#goodsPrice")[0].value = obj.getElementsByClassName('goodsPrice')[0].innerHTML;
		$("#goods_modal").modal();
	}

	function showOrder() {
		$("#order_modal").modal();
	}

	function showLinkMan() {
		$("#LinkMan_modal").modal();
	}

	function addLinkMan() {
		$("#addLinkMan_modal").modal();
	}
	function changeUserInfo() {
		$("#user_info_modal").modal();
	}
	function changeLinkMan(obj) {
		console.log(obj.dataset.linkmanid);
		console.log($(".receiver_" + obj.dataset.linkmanid));
		/* console.log(obj.getElementsByClassName('r_id')[0].innerHTML);
		$("#r_id")[0].value = obj.getElementsByClassName('r_id')[0].innerHTML; */
		$('input:text[name="r_id"]').attr('value',
				$(".receiver_" + obj.dataset.linkmanid)[0].innerHTML);
		$('input:text[name="r_name"]').attr('value',
				$(".receiver_" + obj.dataset.linkmanid)[1].innerHTML);
		$('input:text[name="r_phone"]').attr('value',
				$(".receiver_" + obj.dataset.linkmanid)[2].innerHTML);
		$('input:text[name="r_privince"]').attr('value',
				$(".receiver_" + obj.dataset.linkmanid)[3].innerHTML);
		$('input:text[name="r_city"]').attr('value',
				$(".receiver_" + obj.dataset.linkmanid)[4].innerHTML);
		$('input:text[name="r_address"]').attr('value',
				$(".receiver_" + obj.dataset.linkmanid)[5].innerHTML);
		$("#changeLinkMan_modal").modal();
	}
	//保存用户联系人
	function saveLinkMan(id) {
		console.log(id);
	}
	function hidechangeLinkMan() {
		$("#changeLinkMan_modal").modal("hide");
	}
	function hideaddLinkMan() {
		$("#addLinkMan_modal").modal("hide");
	}
	function hideuserInfo() {
		$("#user_info_modal").modal("hide");
	}
</script>

</html>